package com.example.helloworld;

public class Counter {
    public static int counter = 0;
    private String name = "APP";
    public Counter(){
        counter++;
    }

    public class MyCounter{
        private String myname = "邓先生111222222";
//        public MyCounter(){
//            System.out.println(myname);
//        }
        public String getMyname(){
            return myname;
        }
    }

    public class MyOtherClass{
        private String myname;
        public void myOtherMethod(){
            MyCounter mycounter = new MyCounter();
            String name = mycounter.getMyname();
            myname = name;
        }

        public String getMyname(){
            return myname;
        }
    }

    public static int getCounter(){
        return counter;
    }

    public static void main (String [] args){
        Counter counter1 = new Counter();
        Counter counter2 = new Counter();
        Counter counter3 = new Counter();

//        Counter.MyCounter mycounter = counter1.new MyCounter();
        Counter.MyOtherClass myother = counter1.new MyOtherClass();

        myother.myOtherMethod();
        String myOtherName = myother.getMyname();
        System.out.println(myOtherName);

//        System.out.println("目前为止创建的对象数: " + Counter.getCounter());
    }

}
